<?php

/**
 * 
 * @author yuxun
 *
 */
class TmscController extends AdminBaseController {
	
	public function sindex(){
		$this->setTitle('服务器管理');
		$grid   = new PubGrid();

		$header = TmscService::sHeader();
		$data   = TmscService::sData($params);
		if(!$data['state']){
			$this->out['state'] = -1;
			$this->out['msg'] = $data['msg'];
		}else{
			$data = $data['data'];
			$grid->addGrid($header, $data);
			$this->out['grid'] = $grid->show();
		}
	}
	
	public function sadd(){
		$this->setTitle('新增服务器');
	}
	
	public function sdoAdd(){
		$result = TmscService::sdoAdd($_POST);
		 
		if($result['state']){
			$this->showMessage('添加成功', PubFunc::buildUrl('/oss/?r=tmsc/sindex'));
		}else{
			$this->showMessage($result['msg']);
		}
	}
	
	public function edit(){
		$name = $this->R('name');
		$info = TmscService::sget($name);
	
		if(empty($info)) $this->showMessage('找不到该信息');
	
		$this->setTitle('编辑服务器', $info['name']);
	
		$this->out['info'] = $info;
		
	}
	
	public function cindex(){
		$this->setTitle('渠道管理');
		$grid   = new PubGrid();
	
		$header = TmscService::cHeader();
		$data   = TmscService::cData($params);
		
		if(!$data['state']){
			$this->out['state'] = -1;
			$this->out['msg'] = $data['msg'];
		}else{
			$data = $data['data'];
			$grid->addGrid($header, $data);
			$this->out['grid'] = $grid->show();
		}
	}
	
	
	
	
	
	


    

}